package com.ruoyi.web.task;

import com.ruoyi.common.core.domain.hospital.HospitalRunner;
import com.ruoyi.common.core.domain.hospital.OutPatList;
import com.ruoyi.common.utils.MsgType;
import com.ruoyi.common.utils.POSTUtil;
import com.ruoyi.hospital.service.IActPatListService;
import com.ruoyi.hospital.service.IHospitalRunnerService;
import com.ruoyi.hospital.service.IMrInLabService;
import com.ruoyi.hospital.service.IMrOutDataService;
import com.ruoyi.system.service.LsYySqlServerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.util.List;

@Configuration
@EnableScheduling
public class HosptialRunner {

    @Autowired
    IMrInLabService mrInLabService;
    @Autowired
    IMrOutDataService mrOutDataService;
    @Autowired
    IActPatListService actPatListService;
    @Autowired
    IHospitalRunnerService hospitalRunnerService;
    @Autowired
    LsYySqlServerService lsYySqlServerService;

    //定时上传门诊基础数据
    public void postMrOutData(){
        //查询所有的门诊数据
        List<HospitalRunner> list =hospitalRunnerService.queryRunnerList(MsgType.mrOutData,null);
        if(!list.isEmpty()){
            //如果list非空查询xml并上传数据
            for(HospitalRunner hospitalRunner : list){
                //查询xml
                String mrOutData = lsYySqlServerService.getMrOutData(hospitalRunner.getPatientId(),Integer.parseInt(hospitalRunner.getVistTimes()));
                if(mrOutData != null){
                    POSTUtil.sendMrInData(mrOutData,MsgType.mrOutAcc);
                }
            }
        }
    }

    //定时上传住院基础数据

    //定时上传检查报告数据

    //定时上传实验室检查报告数据

}
